package com.ys.enume.sys;

public class YsGridColEnum {
	
	// 前台控件类型
	public enum FrontType {
		TEXT("文本框", "t_text"),
		TEXT_NUMBER("数值输入框", "t_number"),
		FILE("附件(单)", "t_file"),
		FILE_MULTY("附件(多)", "t_file_multy"),
		IMG("图片", "t_img"),
		SELECTOR_DROPDOWN("下拉框", "t_dropdown"),
		SELECTOR_MODAL_SINGLE("弹出框(单选)", "t_buttontext"),
		SELECTOR_SWITCH("选择框(转换)", "t_checkbox"),
		DATE_YY("年份选择框", "t_year"),
		DATE_YYMM("年月选择框", "t_month"),
		DATE_YYMMDD("日期选择框", "t_date"),
		DATE_YYMMDDHHMMSS("日期时间选择框", "t_datetime"),
		SELF_DEFINE_TPL("自定义脚本", "t_self_define_tpl");
		public String name;
		public String value;

		private FrontType(String name, String value) {
			this.name = name;
			this.value = value;
		}

		public static String getName(String value) {
			for (FrontType e : FrontType.values()) {
				if (e.value == value) {
					return e.name;
				}
			}

			return "";
		}
		
		public static boolean checkIn(String value) {
			if (value == null) {
				return false;
			} else {
				for (FrontType e : FrontType.values()) {
					if (value.equals(e.value)) {
						return true;
					}
				}
			}
			return false;
		}
	}
	
	// 前台是否固定
	public enum FrontFixed {
		NO("无固定", 0), LEFT("左固定", 1), RIGHT("右固定", 2);
		public String name;
		public Integer value;

		private FrontFixed(String name, Integer value) {
			this.name = name;
			this.value = value;
		}

		public static String getLayerFiexd(Integer value) {
			if (value == null || value == NO.value) {
				return null;
			} else if (value == LEFT.value) {
				return "left";
			} else if (value == RIGHT.value) {
				return "right";
			}
			return null;
		}
	}
	
	// 前台对齐方式
	public enum FrontAlign {
		CENTER("中间对齐", 0), LEFT("左对齐", 1), RIGHT("右对齐", 2);
		public String name;
		public Integer value;

		private FrontAlign(String name, Integer value) {
			this.name = name;
			this.value = value;
		}

		public static String getLayerAlign(Integer value) {
			if (value == null || value == CENTER.value) {
				return "center";
			} else if (value == LEFT.value) {
				return "left";
			} else if (value == RIGHT.value) {
				return "right";
			}
			return null;
		}
	}
	
	// 字段显示控制
	public enum FrontShow {
		SHOW("显示", 1),
		HIDDEN("隐藏", 0);
		public String name;
		public Integer value;

		private FrontShow(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 是否可编辑
	public enum FrontEdit {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FrontEdit(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 是否合计
	public enum TotalRow {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private TotalRow(String name, Integer value) {
			this.name = name;
			this.value = value;
		}

		public static boolean getLayerValue(int value) {
			if (value == TotalRow.YES.value) {
				return true;
			} else {
				return false;
			}
		}
	}
}
